package com.showcai.service.provider.user.service;

import com.github.pagehelper.PageInfo;
import com.showcai.module.vo.User;
import com.showcai.service.provider.user.dao.UserMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
/**
 * Created by Baggio on 2018-6-25.
 */
@Service
public class UserServiceImpl implements UserService {
    private final static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
    @Autowired
UserMapper userMapper;
    @Override
    public User getUserByid(Long id) {
        User user=userMapper.getUserById(id);
        logger.info("getUser===============>>>"+user);
        return user;
    }

    @Override
    public List<User> getUserList(Map<String, String> map) {
        System.out.println("getNewsList");
        System.out.println(map.toString());
       return userMapper.getUserList(map);

    }

    @Override
    public PageInfo getUserListPageInfo(Map<String, String> map) {
        System.out.println("getNewsList===>PageINfo");
        Integer page=0;
        Integer pageSize=0;
        if (page == null || page == 0) {
            page = 0;
        }
        // 设置每页记录数
        if (pageSize == null || pageSize == 0) {
            pageSize = 10;
        }
        List<User>  userList= userMapper.getUserList(map);
        PageInfo<User> pageInfo = new PageInfo<>(userList);

        System.out.println("获取nws");

        return pageInfo;
    }

    @Override
    public void mdifiyUser(User user) {

    }
}
